#pragma once

#include <refbase.h>
#include <string>
#include <singleton_delegator.h>

class MySocketServer : public RefBase {
public:
    static const sptr<MySocketServer> &GetInstance();
    int Start(int port);
    void Run();
    void Stop();

private:
    MySocketServer() = default;
    virtual ~MySocketServer() = default;
    static inline sptr<MySocketServer> instance = nullptr;
    static inline SingletonDelegator<MySocketServer> delegator;

    int socketFd = -1;
    int connFd = -1;
    int interruptFd = -1;
};
